#include "jump.h"
#include "ui_jump.h"
#include<QPainter>
#include<mypushbutton.h>
#include<QDebug>
#include<QTimer>
jump::jump(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::jump)
{
    ui->setupUi(this);
    setFixedSize(400,688);
    setWindowIcon(QIcon(":/tz1.jpg"));
    setWindowTitle("团子跳跃");
    //开始退出
    connect(ui->actionquit,&QAction::triggered,[=](){
        this->close();
    });
    mypushbutton*starbtn=new mypushbutton(":/ks.jpg");
    starbtn->setParent(this);
    starbtn->move(this->width()*0.5-starbtn->width()*0.5,this->height()*0.6);
    choosescenc=new choselevescene;
    connect(starbtn,&mypushbutton::clicked,[=](){
                qDebug() << "click";
                starbtn->zoom1();
                QTimer::singleShot(50,this,[=](){
                    starbtn->zoom2();
                });

                //延时进入
                QTimer::singleShot(500,this,[=](){
                    //自身隐藏
                    this->hide();
                    //进入游戏
                    choosescenc->show();
                });


            });


}
//设置背景
void jump::paintEvent(QPaintEvent*)
{
    QPainter painter(this);
    QPixmap pix;
    pix.load(":/bj.jpg");
    painter.drawPixmap(0,0,this->width(),this->height(),pix);
    pix.load(":/bt.png");
    painter.drawPixmap(0,50,pix);

}
jump::~jump()
{
    delete ui;
}
